﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XDL.Framework;

namespace XDL.Framework.Screens
{
    /// <summary>
    /// Single line visual element.
    /// </summary>
    public class Separator : 
        UIElement
    {
        string m_texturePath;
        Texture2D m_texture;

        public Separator(string path)
        {
            m_texturePath = path;
        }

        public override void LoadContent()
        {
            base.LoadContent();
            m_texture = GameServices.Game.Content.Load<Texture2D>(m_texturePath);
        }

        public override void Draw(
            MenuScreen screen, 
            Microsoft.Xna.Framework.Vector2 position, 
            bool isSelected, 
            Microsoft.Xna.Framework.GameTime gameTime)
        {
            screen.ScreenManager.SpriteBatch.Draw(
                m_texture, new Rectangle((int)position.X, (int)position.Y, screen.GetDrawArea().Width, m_texture.Height),
                Color.White);
        }

        public override Microsoft.Xna.Framework.Vector2 Measure()
        {
            return new Vector2(1, m_texture.Height);
        }

        public override void HandleInput(XDL.Framework.Input.InputState input)
        {
            // does nothing
        }
    }
}
